<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class News extends CI_Controller {

	public function __construct(){
		parent::__construct();
		$this->load->model('news_model');
	}

	public function index(){
		
		$data['news'] = $this->news_model->get_news();
		$data['title'] = 'Archivo de noticias';

		$this->load->view('templates/header', $data);
		$this->load->view('news/index', $data);
		$this->load->view('templates/footer', $data);
	} //EndFunction(index)

	public function view($ficha){
		$data['news_item'] = $this->news_model->get_news($ficha);
		if (empty($data['news_item']))
		{
			show_404();
		}
		$data['title'] = $data['news_item']['title'];
		$this->load->view('templates/header', $data);
		$this->load->view('news/view', $data);
		$this->load->view('templates/footer');
	} //EndFunction(view)

}//EndClass(News)

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */